	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
	<%@page import="com.common.controller.SessionHelper"%>
	<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
		pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Blog Test</title>
		<style>
		</style>
	</head>
	
	<body>
		<%
        SessionHelper sh = new SessionHelper(request.getSession(true));		
        if (sh.isLoggedIn()) {
    	%>
		<form method="post" action="account/save">
			<input type = "hidden" name="accountid" id ="accountid">
			Username:
            <input type="text" id="username" name="username"/><br>
            Password:
            <input type="password" id="password" name="password"/>
            <input type="submit" value="Submit"/>	
		</form>

		<table>
			<c:forEach items="${messages}" var="message">		
				<tr>		
					<td>
						message.accountid;
					</td>	
			        <td>
			        	message.message
			        </td>		
				</tr>
		    </c:forEach>	    
	    </table>
<%        } else{ %>

		<table border = 1>
			<c:forEach items="${messages}" var="message">
				<tr>		
					<td>
						message.accountid;
					</td>	
			        <td>
			        	message.message
			        </td>		 		
			        <td>
			        	<a href="/BlogTest/message/delete/${message.messageid}">DELETE</a>
			        </td>
			        <td>
			        	<a href="/BlogTest/message/update/${message.messageid}">EDIT</a>
			        </td>
				</tr>
		    </c:forEach>

		
		    <form method="post" action="account/message">
		    	<input type = "hidden" name="messageid" id ="messageid">
		    	<input type ="hidden" value = "<% session.getAttribute("user_id"); %>" name="accountid" id="accountid">
		    	<input type="text" id="message" name="message"/>
		    	<input type="submit" value="Submit"/>	
		    </form>
		    
  		</table>
    <% 	}   %>
	</body>
</html>